package chap03;

public class supertest {
    public static void main(String[] args) {
        Person_super a = new Person_super("1", "2", 2);
        Student_super s=new Student_super("1","2",3);
//        s.eat();
        s.eat();
    }
}

class Person_super {
    public String name;
    public String sex;
    public int age;

    public Person_super(String name, String sex, int age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
    }

    public void eat() {
        System.out.println("eat something");
    }
}

class Student_super extends Person_super {
    public Student_super(String name, String sex, int age) {
        super(name, sex, age);
    }

    public void school() {
        System.out.println("need to study");
    }

    public void eat() {
        super.eat();
        System.out.println(this.name + "is have dinner in school");
    }
}

